<?php

/*
Process Add Enemy (admin_add_enemy.pro.php)
*/

$rank_check = "7";
include "../global.inc.php";

$explodePets = explode(", ", $learned_by);
$countPets = count($explodePets) - 1;

if ($learned_by)
{
for ($a = 0; $a <= $countPets;)
{
	$findItem = fetch("SELECT * FROM pets2 WHERE name = '$explodePets[$a]' AND game = '$game'");
	if (!$findItem[id])
	{
		die(header(error("admin_add_attacks.php?game=$game","The pet \"$explodePets[$a]\" does not exsist!")));
	}
	$a++;
}
}

$check = fetch("SELECT id FROM attacks2 WHERE attack_name = '$attack_name' AND game = '$game'");

if ((!$attack_name) OR (!$do_what) OR (!$power_level))
{
	die(header(error("admin_add_attacks.php?game=$game", "Please do not leave any information blank!")));
}

if ($check[id])
{
	die(header(error("admin_add_attacks.php?game=$game", "There is already an attack with the name $attack_name.")));
}
else
{
	mysql_query("INSERT INTO attacks2 (attack_name,do_what,magic_number,learned_by,learn_at_level,game) VALUES ('$attack_name','$do_what','$power_level','$learned_by','$level_leared','$game')");
	
	header("Location: admin_add_attacks.php?game=$game&error=The+attack+$attack_name+has+been+added!");
}

?>
